﻿using System;
using System.Xml.Linq;
using IcicleFramework.Entities;
using Microsoft.Xna.Framework;

namespace IcicleFramework.Components
{
    public abstract class BaseComponent : IBaseComponent
    {
        public virtual bool Active { get; set; }

        public virtual IGameObject Parent { get; set; }

        public virtual Type BaseType { get; set; }

        public bool Paused { get; protected set; }
        
        public virtual void Initialize() {}

        public virtual void PostInitialize() {}

        protected BaseComponent() { }

        protected BaseComponent(BaseComponent old)
        {
            this.Parent = old.Parent;
            this.BaseType = BaseType;
        }

        public virtual void Update(GameTime gameTime)
        {}

        public virtual void Pause()
        {
            Paused = true;
        }

        public virtual void Resume()
        {
            Paused = false;
        }
        
        public abstract IBaseComponent DeepClone();

        public abstract void Deserialize(XElement element);

        public virtual void Dispose()
        {
            
        }
    }
}
